<template>
	<view>
		<!-- 未关联企业信息 -->
		<view>
			<u--form labelAlign="right" labelWidth="140rpx">
				<view class="informationCss">
					<u-form-item label="企业名称: " />
					<u-input placeholder="请输入内容" border="surround" v-model="enterpriseData.name" clearable @change="getEnterpriseData"/>
				</view>
				<view class="informationCss">
					<u-form-item label="联系人: " />
					<u-input placeholder="请输入内容" border="surround" v-model="enterpriseData.contact" clearable />
				</view>

				<view class="informationCss">
					<u-form-item label="联系电话: " />
					<u-input placeholder="请输入内容" border="surround" v-model="enterpriseData.phone" clearable />
				</view>
				<view class="informationCss">
					<u-form-item label="地址: " />
					<u-input placeholder="请输入内容" border="surround" v-model="enterpriseData.address" clearable />
				</view>
				<view class="informationCss">
					<u-form-item label="申请理由:" />
					<u--textarea placeholder="请描述理由..." v-model="desc" autoHeight style="margin-right: -2rpx;" />
				</view>
				<view class="infoButton">
					<u-button type="primary" text="提交申请" @click="submitApply"></u-button>
				</view>
			</u--form>
		</view>
	</view>
</template>

<script>
	export default {

		data() {
			return {
				show: false,
				mode: 'single',
				enterpriseData: {
					name: '',
					contact: '',
					address: '',
					phone: ''
				},
				desc: '',
				page: 1,
				limit: 20,
				enterpriseList: []
			}
		},
		onLoad() {
			this.getTabList()
		},
		methods: {
			getTabList() {
				const that = this
				that.$api.request('advert', 'company', {
					page: that.page,
					limit: that.limit,
					unitType: 2
				}).then(res => {
					console.log(res.data.items, 33336);
					that.enterpriseList = res.data.items

				})
			},
			getEnterpriseData() {
					for (var i = 0; i < this.enterpriseList.length; i++) {
						if (this.enterpriseData.name == this.enterpriseList[i].name) {
							this.$api.request('enterprise', 'eDetail', {
								enterpriseId: this.enterpriseList[i].id
							}).then(res => {
								this.enterpriseData = res.data
							})
						}
					}
			},
			submitApply(){
				
			}
		}
	}
</script>

<style lang="scss">
	uni-view.u-popup {
		flex: none;
	}

	uni-view.u-textarea.u-border.u-textarea--radius {
		margin: 0 20rpx 0 0;
	}

	.informationCss {
		display: flex;
		justify-content: space-between;
		padding: 20rpx 30rpx;
		border-bottom: 1px solid #eee;
	}

	.informationCss1 {
		display: flex;
		padding: 20rpx 30rpx;
		border-bottom: 1px solid #eee;
	}

	.infoTextarea {
		display: flex;
		padding: 30rpx 0 30rpx 30rpx;
		margin-right: 20rpx;
	}

	.infoButton {
		display: flex;
		margin: 0 auto;
		padding: 30rpx;
	}
</style>
